<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WanDa</title>
<script type="text/javascript" src="/skin/WDYYhtml/js/jquery.js"></script>
<script type="text/javascript" src="/skin/WDYYhtml/js/common.js"></script>
<link rel="stylesheet" href="/skin/WDYYhtml/css/style.css" type="text/css" media="all" />
<script type="text/javascript" src="/include/manage/js/ajaxfileupload.js"></script>
<script>
function ajaxFileUpload(){
		//starting setting some animation when the ajax starts and completes
		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});
		
		$.ajaxFileUpload
         (
             {
                 url:'/user.do',//用于文件上传的服务器端请求地址
                secureuri:false,
                fileElementId:'upavatar',
                dataType: 'json',//返回值类型 一般设置为json
                data: {
            		"parameter": "upAvatar"
				},
                success: function (data, status)  //服务器成功响应处理函数
                {
                     if(typeof(data.error) != 'undefined')
                     {
                         if(data.error != '')
                         {
                             alert(data.error);
                         }else
                         {
                             alert(data.msg);
                         }
                     }
                 },
                 error: function (data, status, e)//服务器响应失败处理函数
                {
                     alert(e);
                 }
             }
		);
		return false;
} 
</script>
</head>

<body>
#parse('/inc/user_head.htm')

<!---->
<div id="Wrapper">
	<div class="wrapper mwrapper">
		<div class="mem">
			<div class="mmenu">
				<a href="/user.do?parameter=index">首页</a>
				<!--#if($user.isfee>0)
				<a href="/user.do?parameter=show">作品秀</a>
				#end-->
				<a class="active" href="/user.do?parameter=profile">个人资料</a>
				<a href="/user.do?parameter=editPassword">修改密码</a>
			</div>
			
			<!---->
			<div class="c5">
				<div class="upava">
					<div class="avatar"><img src="$!user.avatar" alt="" /></div>
					<a href="javascript:void(0)" onclick="_getUp()">上传头像</a>
					图片尺寸<br />235x250 px
				</div>
				<div class="c5c">
					<h3>$user.acount</h3>
					<ul><li><strong> [ WANDA A&E ] #if($user.isfee>1) 艺员会员 #else 观众会员 #end</strong></li>
						<li><strong>$!user.professional</strong></li>
						<li><strong>个人标签：</strong>
							#if(!$user.hobby.equals("null"))
							#set($userLabel=$user.hobby.split(" "))
							#foreach($alabel in $userLabel)
							<em>$alabel</em>
							#end
							#end
						</li>
					</ul>
					#if($user.isfee>1)
					<span class="num">$!user.count</span>
					#end
				</div>
			</div>
			
			<form id="changeInfo" name="changeInfo" action="/user.do?parameter=changeInfo" method="post">
			<div class="rform mprofile">
				<h3>个人资料</h3>
				<ul><li><strong>用户名：</strong><input type="text" value="$!user.acount" name="acount" disabled /></li>
					<li><strong>Email:</strong><input type="text" value="$!user.email" name="email" /></li>
					<li><strong>您所在的地址：</strong><input class="t4" type="text" value="$!user.homearea" name="homearea" /></li>
					<li><strong>您所从事的职业：</strong><input type="text" value="$!user.professional" name="professional" /></li>
					<li><strong>个人标签：</strong><input class="t6" type="text" value="$!user.hobby" name="hobby" /></li>
				</ul>
				<div class="rbtn">
					<button name="submit" onclick="changeInfo.submit()">提交修改</button>
				</div>
			</div>
			</form>
		</div>
	</div>
	<div class="footer">
		#parse('/inc/copyright.htm')
		<p></p>
		<p></p>	
	</div>
</div>

<!---->
<div class="footer-wrapper">
	<div class="footer">
	#parse('/inc/nav.htm')
			
	</div>
</div>

<!---->
<div id="NavLeft"><a href="javascript:void(0)">Show</a></div>
<div id="NavRight"><a href="javascript:void(0)">Star</a></div>

<div class="updialog" id="UpDialog">
	<p class="tip">温馨提示：您的最佳头像尺寸为：235pxX250px</p>
	<p class="upfile">
		<img id="loading" src="/include/manage/js/loading.gif" style="display:none;">
		<input id="upavatar" class="file" type="file" name="avatar" />
		<input class="btn" type="button" value="上传" name="button" onclick="return ajaxFileUpload();" />
	</p>
	<h5>预览头像</h5>
	<div class="avatar">
		<img id="pavatar" src="$!user.avatar" />
	</div>
	<input class="btn" type="button" value="预览" name="preview" onclick="previewAvatar()" />
	
	<p class="btns">
		<input type="button" value="完成" name="ok" onclick="window.location.reload()" />
		<a href="javascript:void(0)" onclick="hideUp()">取消</a>
	</p>
</div>

<script type="text/javascript">
function previewAvatar(){
	$.get('/user.do?parameter=previewAvatar',function(data){
		$('#pavatar')[0].src=data;
	});
}

function _getUp(){
	var __d = $("#UpDialog");
	var w = document.documentElement.clientWidth || document.body.clientWidth, h = document.documentElement.clientHeight || document.body.clientHeight, st = document.documentElement.scrollTop || document.body.scrollTop;
	var dw = __d.outerWidth(), dh = __d.outerHeight();
	
	if($("#bgDiv").length == 0){
		$("body").append('<div id="bgDiv" onclick="hideUp()">');
	}
	$("#bgDiv").css({height:$("body").height(),"opacity":0.5}).fadeIn();
	
	__d.css({top:(h-dh)/2 + st,left:(w-dw)/2}).fadeIn();
}

function hideUp(){
	$("#bgDiv,#UpDialog").fadeOut();
}
</script>
</body>
</html>
